export default {
	delArrBlank(arr){
	  arr = arr.filter(item=>{
	    item = item.replace(/\s*/g, '');
	
	    return item!=="";
	
	  });
	  return arr;
	},
	convertComma(str){
		str = str.replace(/[\uff0c]/g,",");
		return str;
	},
	setLocalStorage(key,data){
		let str = JSON.stringify(data);
		localStorage.setItem(key,str);
	},
	getLocalStorage(key){
		let res = localStorage.getItem(key);
		res = JSON.parse(res);
		return res;
	},
	setSessionStorage(key,data){
		let str = JSON.stringify(data);
		sessionStorage.setItem(key,str);
	},
	getSessionStorage(key){
		let res = sessionStorage.getItem(key);
		res = JSON.parse(res);
		return res;
	},
	compare(property){
	    return (a,b)=>{
	        var value1 = a[property];
	        var value2 = b[property];
	        return value1 - value2;
	    }
	},
	// console.log(arr.sort(compare('age')));
	delBlank(str) {
	  return str.replace(/\s*/g, '')
	},
	 
	getTimestamp10(){
		  const NOW =  Math.round(new Date().getTime()/1000).toString();
		  return NOW;
	}
	,
	convertArr(obj){
			  return new Promise((resolve,reject)=>{
				  let arr = [];
				  let {keys,values,entries} = Object;
				  for(let [key,val] of entries(obj)){
				  	arr.push(val);
					
				  }
				  resolve(arr);
			  })
		 
	},
	convertObj(obj){
			  return new Promise((resolve,reject)=>{
				  let objs = {};
				  let {keys,values,entries} = Object;
				  for(let [key,val] of entries(obj)){
				  	objs[key] = val;
					
				  }
				  
				  resolve(objs);
			  })
		 
	},
	isArrayFn(obj){
	if (typeof Array.isArray === "function") {
	return Array.isArray(obj);
	}else{
	return Object.prototype.toString.call(obj) === "[object Array]";
	}
	},
}